#! /bin/bash

SSH_PORT=${SSH_PORT:-"22"}
SSH_USERNAME=${SSH_USERNAME:-"root"}
VERSION=${VERSION:-"1.15.7"}

sed -i "s|{{SSH_HOST}}|${SSH_HOST}|g" /var/cluster-operator/kubeadm-ha/config.ini
sed -i "s|{{SSH_PORT}}|${SSH_PORT}|g" /var/cluster-operator/kubeadm-ha/config.ini
sed -i "s|{{SSH_USERNAME}}|${SSH_USERNAME}|g" /var/cluster-operator/kubeadm-ha/config.ini
sed -i "s|{{SSH_PASSWORD}}|${SSH_PASSWORD}|g" /var/cluster-operator/kubeadm-ha/config.ini
sed -i "s|{{VERSION}}|${VERSION}|g" /var/cluster-operator/kubeadm-ha/config.ini

ansible-playbook -i config.ini 90-init-cluster.yml
